﻿/*!	@file	r_draw_texture2d.h
	@brief	2Dテクスチャ既定
Copyright (c) 2010 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _R_DRAW_TEXTURE2D_H_
#define _R_DRAW_TEXTURE2D_H_

#include "r_draw_texture2d_desc.h"
#include "../alloc/r_alloc_new_delete.h"

namespace r{
	namespace draw{
		//! 2次元テクスチャクラス
		/*!
		*/
		class Texture2D : public r::rtti::ClassBase
		{
			RRTTI_REFLECTION_DECLARE
		public:
			RALLOC_PLACEMENT_NEW_DELETE_DECLEARE
		__r_serialize:
			//! RTTI用未使用
			Texture2D();
		protected:
			//! コンストラクタ
			Texture2D ( const Texture2DDesc& _desc );
			//! デストラクタ
			virtual ~Texture2D();
		public:
			//! 生成関数
			static Texture2D*			create( const Texture2DDesc& desc );
			static Texture2D*			create( const Texture2DDesc& desc, const void* buff, r_size buffSize );
			//! 破棄関数
			virtual void	destroy( void );
		public:
			//! テクスチャ定義情報を取得
			/***/
			const Texture2DDesc&	getDesc()const;
		public:
			//! データを転送する
			/*! この関数を使用する前にmap2DTextureによってCPUアクセスが可能な状態にする必要がある。
			幅と高さ、フォーマットはTexture2DDescに沿った形式である必要がある。
			@param	data	[in]	テクスチャデータ
			*/
			virtual	void			texImage( const void* data, r_ui32 mipLevel ){}
			//! 指定ピクセルに書き込む
			//! 指定ピクセルを読み取る
		protected:
		private:
			// コピー禁止
			Texture2D ( const Texture2D& );
			Texture2D& operator = ( const Texture2D& );
		private:
			//! テクスチャ情報
			Texture2DDesc		desc;
		};
	}
}

#endif // _R_DRAW_TEXTURE2D_H_
